package com.dao.impl;

import com.dao.MajorDetilDao;
import com.entiy.MajortableEntity;
import com.factory.HibernateFactory;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.query.Query;

import java.util.List;

public class MajorDetilDaoImp implements MajorDetilDao {
    @Override
    public List getAll() {
        Session session = HibernateFactory.getSession();
        Transaction transaction = session.beginTransaction();
        List list = session.createQuery("from CourseinformationtableEntity order by coursenumber").list();
        transaction.commit();
        return null;
    }

    @Override
    public MajortableEntity getInfo(int coursenumber) {
        Session session = HibernateFactory.getSession();
        Transaction transaction = session.beginTransaction();
        Query query = session.createQuery("from CourseinformationtableEntity where coursenumber = ?1");
        query.setParameter(1,coursenumber);
        query.setMaxResults(1);

        return null;
    }
}
